// Downsample by 4, average four src pixels to determine new pixel
samplerRect src0;
samplerRect src1;
samplerRect src2;
uniform float reduction;

void main(void)
{
	vec2 coord = gl_FragCoord*reduction;

	gl_FragData[0] = (textureRect(src0, coord) + 
		textureRect(src0, coord + vec2(1,0)) + 
		textureRect(src0, coord + vec2(1,1)) +
		textureRect(src0, coord + vec2(0,1)))/4.0;

	gl_FragData[1] = (textureRect(src1, coord) + 
		textureRect(src1, coord + vec2(1,0)) + 
		textureRect(src1, coord + vec2(1,1)) +
		textureRect(src1, coord + vec2(0,1)))/4.0;

	gl_FragData[2] = (textureRect(src2, coord) + 
		textureRect(src2, coord + vec2(1,0)) + 
		textureRect(src2, coord + vec2(1,1)) +
		textureRect(src2, coord + vec2(0,1)))/4.0;
}
